'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
   async index() {
      const {ctx} = this;
      const blogs = await ctx.service.blog.index({});
      await ctx.render('index.tpl', {blogs: blogs.rows});
   }

   async about() {
      const {ctx} = this;
      await ctx.render('about.tpl');
   }

   async contact() {
      const {ctx} = this;
      await ctx.render('contact.tpl');
   }

   async blog() {
      const {ctx} = this;
      await ctx.render('blog.tpl');
   }
}

module.exports = HomeController;
